﻿using System;
using System.Collections.Generic;
using System.Text;
using Kingdee.BOS.Core.CloudModel;
using Kingdee.BOS.Core.CloudModel.Cloud;
using Kingdee.BOS.Core.CloudModel.Crm;
using Newtonsoft.Json;

namespace MethodSetBus
{
    public class BD_CustomerBus
    {
        public string Get_CustomerData(Crm_AccountsQuery _AccountsQuery)
        {
			Root<BD_Customer> root = new Root<BD_Customer>();
			root.IsDeleteEntry = "true";
			root.IsVerifyBaseDataField = "false";
			root.IsEntryBatchFill = "true";
			root.ValidateFlag = "true";
			root.NumberSearch = "true";
			root.IsAutoAdjustField = "false";
			root.IsControlPrecision = "false";
			root.ValidateRepeatJson = "false";
			try
            {
                root.Model = new BD_Customer();

                BD_Customer _Customer = new BD_Customer();

				_Customer.FCUSTID = 0;
				_Customer.FCreateOrgId = new OrgBase
				{
					FNumber = "102"
				};
				_Customer.FUseOrgId = new OrgBase
				{
					FNumber = "102"
				};
				_Customer.FName = _AccountsQuery.accountname;
				_Customer.FNumber = _AccountsQuery.account_no;
				_Customer.FCOUNTRY = new OrgBase
				{
					FNumber = "China"
				};
				_Customer.FINVOICETITLE = _AccountsQuery.accountname;
				_Customer.FIsGroup = "false";
				_Customer.FIsDefPayer = "false";
				_Customer.FCustTypeId = new OrgBase
				{
					FNumber = "KHLB001_SYS"
				};
				_Customer.FTRADINGCURRID = new OrgBase
				{
					FNumber = "PRE001"
				};
				_Customer.FInvoiceType = "1";
				_Customer.FTaxType = new OrgBase
				{
					FNumber = "SFL02_SYS"
				};
				_Customer.FPriority = 1;
				_Customer.FTaxRate = new OrgBase
				{
					FNumber = "SL02_SYS"
				};
				_Customer.FISCREDITCHECK = "true";
				_Customer.FIsTrade = "true";
		        _Customer.FUncheckExpectQty = "false";
				_Customer.FT_BD_CUSTOMEREXT = new FT_BD_CUSTOMEREXT();
				FT_BD_CUSTOMEREXT _BD_CUSTOMEREXT = new FT_BD_CUSTOMEREXT();
				_BD_CUSTOMEREXT.FEnableSL = "false";
				_BD_CUSTOMEREXT.FALLOWJOINZHJ = "false";
				_Customer.FT_BD_CUSTOMEREXT = _BD_CUSTOMEREXT;

				root.Model = _Customer;

				return JsonConvert.SerializeObject(root);
			}
            catch (Exception e)
            {
				return JsonConvert.SerializeObject(root);
			}
        }
    }
}
